{smcl}
{com}{sf}{ul off}{txt}{.-}
      name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2010_FEVS_Log.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res}10 Oct 2021, 14:16:27

{com}. do "C:\Users\JUNGYE~1\AppData\Local\Temp\STD3b38_000000.tmp"
{txt}
{com}. import delimited "C:\Users\Jungyeon PARK\Dropbox\DISCRIMINATION PROJECT (U.S. FEDERAL AGENCIES)\FEVS\FEVS_2010-2019\FEVS2010_PRDF.csv
{res}{text}(92 vars, 263,475 obs)

{com}. 
. svyset [pweight=postwt]

      {txt}pweight:{col 16}{res}postwt
          {txt}VCE:{col 16}{res}linearized
  {txt}Single unit:{col 16}{res}missing
     {txt}Strata 1:{col 16}<one>
         SU 1:{col 16}<observations>
        FPC 1:{col 16}<zero>
{p2colreset}{...}

{com}. 
. drop if q17=="X"
{txt}(12,270 observations deleted)

{com}. 
. drop if q17==""
{txt}(1,349 observations deleted)

{com}. 
. drop if q37=="X"
{txt}(11,061 observations deleted)

{com}. 
. drop if q37==""
{txt}(4,350 observations deleted)

{com}. 
. drop if q38=="X"
{txt}(8,649 observations deleted)

{com}. 
. drop if q38==""
{txt}(933 observations deleted)

{com}. 
. destring q17, replace
{txt}q17: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. destring q37, replace
{txt}q37: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. destring q38, replace
{txt}q38: all characters numeric; {res}replaced {txt}as {res}byte
{txt}
{com}. 
. svy linearized : gsem (FAIRNESS -> q17, family(ordinal) link(logit)) (FAIRNESS -> q37, family(ordinal) link(logit)) (FAIRNESS -> q38, family(ordinal) link(logit)), covstruct(_lexogenous, diagonal) latent(FAIRNESS) nocapslatent
{txt}(running gsem on estimation sample)
{res}
{txt}Survey: Generalized structural equation model

{col 1}Number of strata{col 20}= {res}        1{txt}{col 49}Number of obs{col 67}= {res}   224,863
{txt}{col 1}Number of PSUs{col 20}= {res}  224,863{txt}{col 49}Population size{col 67}={res}  1,470,019
{txt}{col 49}Design df{col 67}= {res}   224,862

{txt}Response{col 16}: {res}q17
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{txt}Response{col 16}: {res}q37
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{txt}Response{col 16}: {res}q38
{txt}Family{col 16}: {res}ordinal
{txt}Link{col 16}: {res}logit

{p 0 7}{space 1}{text:( 1)}{space 1} [q17]FAIRNESS = 1{p_end}
{txt}{hline 14}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 15}{c |}{col 27}  Linearized
{col 15}{c |}      Coef.{col 27}   Std. Err.{col 39}      t{col 47}   P>|t|{col 55}     [95% Con{col 68}f. Interval]
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q17           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2}        1{col 27}{txt}  (constrained)
{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q37           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2} 1.881809{col 27}{space 2} .0704255{col 38}{space 1}   26.72{col 47}{space 3}0.000{col 55}{space 4} 1.743777{col 68}{space 3} 2.019841
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}q38           {txt}{c |}
{space 5}FAIRNESS {c |}{col 15}{res}{space 2} 2.295269{col 27}{space 2} .0966757{col 38}{space 1}   23.74{col 47}{space 3}0.000{col 55}{space 4} 2.105787{col 68}{space 3} 2.484751
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q17          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-3.354696{col 27}{space 2} .0573559{col 55}{space 4}-3.467112{col 68}{space 3} -3.24228
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-2.217538{col 27}{space 2} .0394006{col 55}{space 4}-2.294762{col 68}{space 3}-2.140314
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-.7856783{col 27}{space 2}  .029583{col 55}{space 4}-.8436602{col 68}{space 3}-.7276963
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2} 1.829413{col 27}{space 2} .0368411{col 55}{space 4} 1.757205{col 68}{space 3}  1.90162
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q37          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-4.630451{col 27}{space 2} .1207248{col 55}{space 4}-4.867069{col 68}{space 3}-4.393834
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-2.796842{col 27}{space 2} .0831118{col 55}{space 4}-2.959739{col 68}{space 3}-2.633945
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-.3314248{col 27}{space 2} .0454815{col 55}{space 4}-.4205674{col 68}{space 3}-.2422822
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2}  3.80052{col 27}{space 2} .0989708{col 55}{space 4} 3.606539{col 68}{space 3}   3.9945
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{res}/q38          {txt}{c |}
{space 9}cut1 {c |}{col 15}{res}{space 2}-6.548129{col 27}{space 2} .1860624{col 55}{space 4}-6.912806{col 68}{space 3}-6.183451
{txt}{space 9}cut2 {c |}{col 15}{res}{space 2}-4.811723{col 27}{space 2} .1400676{col 55}{space 4}-5.086252{col 68}{space 3}-4.537194
{txt}{space 9}cut3 {c |}{col 15}{res}{space 2}-1.790536{col 27}{space 2} .0706711{col 55}{space 4}-1.929049{col 68}{space 3}-1.652022
{txt}{space 9}cut4 {c |}{col 15}{res}{space 2}   3.3266{col 27}{space 2} .1091894{col 55}{space 4} 3.112592{col 68}{space 3} 3.540609
{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 1}var(FAIRNESS){c |}{col 15}{res}{space 2} 3.287279{col 27}{space 2} .1489239{col 55}{space 4} 3.007975{col 68}{space 3} 3.592517
{txt}{hline 14}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. predict fairnessgsem, latent(FAIRNESS)
{txt}(option {bf:ebmeans} assumed)
{res}{txt}(using 7 quadrature points)

{com}. 
. egen average_fairnessgsem = mean (fairnessgsem), by (agency)
{txt}
{com}. 
. egen sub_average_fairnessgsem = mean (fairnessgsem), by (subelem)
{txt}
{com}. 
. svy linearized : sem (FAIRNESSSEM -> q38 q37 q17), covstruct(_lexogenous, diagonal) standardized latent(FAIRNESSSEM) nocapslatent
{txt}(running sem on estimation sample)
{res}
{txt}{col 1}Survey: Structural equation model{col 49}Number of obs{col 67}= {res}   224,863
{txt}{col 1}Number of strata{col 22}= {res}        1{txt}{col 49}Population size{col 67}={res}  1,470,019
{txt}{col 1}Number of PSUs{col 22}= {res}  224,863{txt}{col 49}Design df{col 67}= {res}   224,862

{p 0 7}{space 1}{text:( 1)}{space 1} [q38]FAIRNESSSEM = 1{p_end}
{txt}{hline 16}{c TT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 17}{c |}{col 29}  Linearized
{col 1}   Standardized{col 17}{c |}      Coef.{col 29}   Std. Err.{col 41}      t{col 49}   P>|t|{col 57}     [95% Con{col 70}f. Interval]
{hline 16}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{col 1}{res}Measurement    {col 17}{txt}{c |}
{space 2}{col 3}q38          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2}  .857963{col 29}{space 2} .0056462{col 40}{space 1}  151.95{col 49}{space 3}0.000{col 57}{space 4} .8468965{col 70}{space 3} .8690294
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 3.321962{col 29}{space 2} .0367529{col 40}{space 1}   90.39{col 49}{space 3}0.000{col 57}{space 4} 3.249928{col 70}{space 3} 3.393997
{space 2}{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}{col 3}q37          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .8384864{col 29}{space 2} .0072763{col 40}{space 1}  115.24{col 49}{space 3}0.000{col 57}{space 4} .8242251{col 70}{space 3} .8527477
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 2.793637{col 29}{space 2} .0236753{col 40}{space 1}  118.00{col 49}{space 3}0.000{col 57}{space 4} 2.747234{col 70}{space 3}  2.84004
{space 2}{txt}{hline 14}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 2}{col 3}q17          {col 17}{c |}
{space 4}FAIRNESSSEM {c |}{col 17}{res}{space 2} .6657066{col 29}{space 2} .0094372{col 40}{space 1}   70.54{col 49}{space 3}0.000{col 57}{space 4} .6472098{col 70}{space 3} .6842033
{txt}{space 10}_cons {c |}{col 17}{res}{space 2} 3.010922{col 29}{space 2}  .028631{col 40}{space 1}  105.16{col 49}{space 3}0.000{col 57}{space 4} 2.954806{col 70}{space 3} 3.067038
{txt}{hline 16}{c +}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}
{space 6}var(e.q38){c |}{col 17}{res}{space 2} .2638995{col 29}{space 2} .0096885{col 57}{space 4} .2455774{col 70}{space 3} .2835886
{txt}{space 6}var(e.q37){c |}{col 17}{res}{space 2} .2969406{col 29}{space 2} .0122021{col 57}{space 4} .2739625{col 70}{space 3} .3218459
{txt}{space 6}var(e.q17){c |}{col 17}{res}{space 2} .5568347{col 29}{space 2} .0125649{col 57}{space 4} .5327446{col 70}{space 3} .5820143
{txt}var(FAIRNESSSEM){c |}{col 17}{res}{space 2}        1{col 29}{space 2}        .{col 57}{space 4}        .{col 70}{space 3}        .
{txt}{hline 16}{c BT}{hline 11}{hline 11}{hline 9}{hline 8}{hline 13}{hline 12}

{com}. 
. estat gof, stats(all)
{res}
{txt}{hline 21}{c TT}{hline 54}
{lalign 21:Fit statistic}{c |}      Value   Description
{hline 21}{c +}{hline 54}
{lalign 21:Size of residuals}{c |}
{ralign 20:SRMR} {c |} {res}{ralign 10:     0.000}{txt}   Standardized root mean squared residual
{ralign 20:CD} {c |} {res}{ralign 10:     0.856}{txt}   Coefficient of determination
{hline 21}{c BT}{hline 54}
{p 0 2 2 75}Note: model was fit with{txt} svy: prefix; only stats(residuals) valid.{p_end}

{com}. 
. predict fairnesssem, latent(FAIRNESSSEM)
{res}{txt}
{com}. 
. egen average_fairnesssem = mean (fairnesssem), by (agency)
{txt}
{com}. 
. egen sub_average_fairnesssem = mean (fairnesssem), by (subelem)
{txt}
{com}. 
. correlate fairnessgsem fairnesssem
{txt}(obs=224,863)

             {c |} fai~gsem fai~ssem
{hline 13}{c +}{hline 18}
fairnessgsem {c |}{res}   1.0000
 {txt}fairnesssem {c |}{res}   0.9813   1.0000

{txt}
{com}. 
{txt}end of do-file

{com}. save "C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2010_FEVS_DATA.dta"
{txt}file C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2010_FEVS_DATA.dta saved

{com}. log close
      {txt}name:  {res}<unnamed>
       {txt}log:  {res}C:\Users\Jungyeon PARK\Dropbox\Discrimination Project_for me\FEVS_FACTOR SCORES_ORG FAIRNESS\2010_FEVS_Log.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res}10 Oct 2021, 14:21:33
{txt}{.-}
{smcl}
{txt}{sf}{ul off}